\(\int (a+i a \tan (e+f x)) (c+d \tan (e+f x)) \, dx\) [1067]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 24, antiderivative size = 46 \[ \int (a+i a \tan (e+f x)) (c+d \tan (e+f x)) \, dx=a (c-i d) x-\frac {a (i c+d) \log (\cos (e+f x))}{f}+\frac {i a d \tan (e+f x)}{f} \]

[Out]

a*(c-I*d)*x-a*(I*c+d)*ln(cos(f*x+e))/f+I*a*d*tan(f*x+e)/f

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 46, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.083, Rules used = {3606, 3556} \[ \int (a+i a \tan (e+f x)) (c+d \tan (e+f x)) \, dx=-\frac {a (d+i c) \log (\cos (e+f x))}{f}+a x (c-i d)+\frac {i a d \tan (e+f x)}{f} \]

[In]

Int[(a + I*a*Tan[e + f*x])*(c + d*Tan[e + f*x]),x]

[Out]

a*(c - I*d)*x - (a*(I*c + d)*Log[Cos[e + f*x]])/f + (I*a*d*Tan[e + f*x])/f

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3606

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[b*d*(Tan[e + f*x]/f), x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rubi steps \begin{align*} \text {integral}& = a (c-i d) x+\frac {i a d \tan (e+f x)}{f}+(a (i c+d)) \int \tan (e+f x) \, dx \\ & = a (c-i d) x-\frac {a (i c+d) \log (\cos (e+f x))}{f}+\frac {i a d \tan (e+f x)}{f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.05 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.43 \[ \int (a+i a \tan (e+f x)) (c+d \tan (e+f x)) \, dx=a c x-\frac {i a d \arctan (\tan (e+f x))}{f}-\frac {i a c \log (\cos (e+f x))}{f}-\frac {a d \log (\cos (e+f x))}{f}+\frac {i a d \tan (e+f x)}{f} \]

[In]

Integrate[(a + I*a*Tan[e + f*x])*(c + d*Tan[e + f*x]),x]

[Out]

a*c*x - (I*a*d*ArcTan[Tan[e + f*x]])/f - (I*a*c*Log[Cos[e + f*x]])/f - (a*d*Log[Cos[e + f*x]])/f + (I*a*d*Tan[
e + f*x])/f

Maple [A] (verified)

Time = 0.18 (sec) , antiderivative size = 50, normalized size of antiderivative = 1.09

method result size
derivativedivides \(\frac {a \left (i \tan \left (f x +e \right ) d +\frac {\left (i c +d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (-i d +c \right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) \(50\)
default \(\frac {a \left (i \tan \left (f x +e \right ) d +\frac {\left (i c +d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (-i d +c \right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) \(50\)
norman \(\left (-i a d +a c \right ) x +\frac {i a d \tan \left (f x +e \right )}{f}+\frac {\left (i a c +a d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f}\) \(52\)
parts \(a c x +\frac {\left (i a c +a d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f}+\frac {i a d \left (\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) \(55\)
parallelrisch \(\frac {-2 i x a d f +i \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a c +2 i a d \tan \left (f x +e \right )+2 x a c f +\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a d}{2 f}\) \(61\)
risch \(\frac {2 i a d e}{f}-\frac {2 a c e}{f}-\frac {2 a d}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}-\frac {a \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) d}{f}-\frac {i a \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c}{f}\) \(78\)

[In]

int((a+I*a*tan(f*x+e))*(c+d*tan(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

1/f*a*(I*tan(f*x+e)*d+1/2*(I*c+d)*ln(1+tan(f*x+e)^2)+(c-I*d)*arctan(tan(f*x+e)))

Fricas [A] (verification not implemented)

none

Time = 0.23 (sec) , antiderivative size = 64, normalized size of antiderivative = 1.39 \[ \int (a+i a \tan (e+f x)) (c+d \tan (e+f x)) \, dx=-\frac {2 \, a d - {\left (-i \, a c - a d + {\left (-i \, a c - a d\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )}{f e^{\left (2 i \, f x + 2 i \, e\right )} + f} \]

[In]

integrate((a+I*a*tan(f*x+e))*(c+d*tan(f*x+e)),x, algorithm="fricas")

[Out]

-(2*a*d - (-I*a*c - a*d + (-I*a*c - a*d)*e^(2*I*f*x + 2*I*e))*log(e^(2*I*f*x + 2*I*e) + 1))/(f*e^(2*I*f*x + 2*
I*e) + f)

Sympy [A] (verification not implemented)

Time = 0.22 (sec) , antiderivative size = 53, normalized size of antiderivative = 1.15 \[ \int (a+i a \tan (e+f x)) (c+d \tan (e+f x)) \, dx=- \frac {2 a d}{f e^{2 i e} e^{2 i f x} + f} - \frac {i a \left (c - i d\right ) \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{f} \]

[In]

integrate((a+I*a*tan(f*x+e))*(c+d*tan(f*x+e)),x)

[Out]

-2*a*d/(f*exp(2*I*e)*exp(2*I*f*x) + f) - I*a*(c - I*d)*log(exp(2*I*f*x) + exp(-2*I*e))/f

Maxima [A] (verification not implemented)

none

Time = 0.47 (sec) , antiderivative size = 52, normalized size of antiderivative = 1.13 \[ \int (a+i a \tan (e+f x)) (c+d \tan (e+f x)) \, dx=-\frac {-2 i \, a d \tan \left (f x + e\right ) - 2 \, {\left (a c - i \, a d\right )} {\left (f x + e\right )} + {\left (-i \, a c - a d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{2 \, f} \]

[In]

integrate((a+I*a*tan(f*x+e))*(c+d*tan(f*x+e)),x, algorithm="maxima")

[Out]

-1/2*(-2*I*a*d*tan(f*x + e) - 2*(a*c - I*a*d)*(f*x + e) + (-I*a*c - a*d)*log(tan(f*x + e)^2 + 1))/f

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 103 vs. \(2 (40) = 80\).

Time = 0.34 (sec) , antiderivative size = 103, normalized size of antiderivative = 2.24 \[ \int (a+i a \tan (e+f x)) (c+d \tan (e+f x)) \, dx=\frac {-i \, a c e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - a d e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - i \, a c \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - a d \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 2 \, a d}{f e^{\left (2 i \, f x + 2 i \, e\right )} + f} \]

[In]

integrate((a+I*a*tan(f*x+e))*(c+d*tan(f*x+e)),x, algorithm="giac")

[Out]

(-I*a*c*e^(2*I*f*x + 2*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) - a*d*e^(2*I*f*x + 2*I*e)*log(e^(2*I*f*x + 2*I*e) + 1
) - I*a*c*log(e^(2*I*f*x + 2*I*e) + 1) - a*d*log(e^(2*I*f*x + 2*I*e) + 1) - 2*a*d)/(f*e^(2*I*f*x + 2*I*e) + f)

Mupad [B] (verification not implemented)

Time = 5.38 (sec) , antiderivative size = 38, normalized size of antiderivative = 0.83 \[ \int (a+i a \tan (e+f x)) (c+d \tan (e+f x)) \, dx=\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (a\,d+a\,c\,1{}\mathrm {i}\right )}{f}+\frac {a\,d\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}}{f} \]

[In]

int((a + a*tan(e + f*x)*1i)*(c + d*tan(e + f*x)),x)

[Out]

(log(tan(e + f*x) + 1i)*(a*c*1i + a*d))/f + (a*d*tan(e + f*x)*1i)/f